package org.blogwu.learn.temp;

import java.io.BufferedReader;
import java.io.File;
import java.io.InputStreamReader;
import java.util.HashMap;
import java.util.Map;
import java.util.concurrent.atomic.AtomicInteger;

public class HashMapTest {
    int b = 6;

    public static void main(String[] args) {

//        String ss  ="first";
//
//        String s2 = new String("first");
//        System.out.println(s2 == "first");
//        System.out.println(ss == s2);
//       s2=  s2.intern();
//        System.out.println(ss == s2);
//
//
//
//        HashMapThread hmt0 = new HashMapThread();
//        HashMapThread hmt1 = new HashMapThread();
//        HashMapThread hmt2 = new HashMapThread();
//        HashMapThread hmt3 = new HashMapThread();
//        HashMapThread hmt4 = new HashMapThread();
//        HashMapThread hmt5 = new HashMapThread();
//        HashMapThread hmt6 = new HashMapThread();
//        HashMapThread hmt7 = new HashMapThread();
//        HashMapThread hmt8 = new HashMapThread();
//        HashMapThread hmt9 = new HashMapThread();
//        HashMapThread hmt10 = new HashMapThread();
//        hmt0.start();
//        hmt1.start();
//        hmt2.start();
//        hmt3.start();
//        hmt4.start();
//        hmt5.start();
//        hmt6.start();
//        hmt7.start();
//        hmt8.start();
//        hmt9.start();
//        hmt10.start();
    }
}

class HashMapThread extends Thread
{
    private static AtomicInteger ai = new AtomicInteger(0);
    private static Map<Integer, Integer> map = new HashMap<Integer, Integer>(1);

    @Override
    public void run()
    {
        while (ai.get() < 100000)
        {
            map.put(ai.get(), ai.get());
            ai.incrementAndGet();
        }
        System.out.println(Thread.currentThread().getName() + "执行结束完");
    }
}